package day3;

import day2.pet.Dog;

import java.util.Arrays;
import java.util.Comparator;

/**
 * @author oldliu
 * @since 1.0
 */
public class ArrTest {
    public static void main(String[] args) {
        int a1[]={1,3,6,7,9,100,135,15};
        int a2[]= Arrays.copyOf(a1,5);
        System.out.println(Arrays.toString(a2));
        int []a3=Arrays.copyOf(a1,40);
        System.out.println(Arrays.toString(a3));
        Dog d[]=new Dog[]{
                new Dog("大黄","公",88,77),
                new Dog("小花花","公",64,88),
                new Dog("小泉","公",23,42),
                new Dog("Mary","母",45,72),
                new Dog("贾斯汀","公",66,99),
                new Dog("比伯","公",44,48)
        };
        Arrays.sort(d);
        for(Dog t:d){
            System.out.println(t);
        }
        System.out.println("---------按照可爱程度---排序--------");
        Arrays.sort(d,new MyBijiaoqi());
        for(Dog t:d){
            System.out.println(t);
        }
    }
}
class MyBijiaoqi implements Comparator<Dog>{

    @Override
    public int compare(Dog o1, Dog o2) {
        return o1.getLove()-o2.getLove();
    }

}